﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Collections;

namespace Musicman.Utilities.Configuration.Search
{
    public class SearchLoactionConfigurationCollection : ConfigurationElementCollection, IList
    {
        public override ConfigurationElementCollectionType CollectionType
        {
            get
            {
                return ConfigurationElementCollectionType.AddRemoveClearMap;
            }
        }

        protected override ConfigurationElement CreateNewElement()
        {
            return new SearchLoacationConfigurationElement();
        }

        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((SearchLoacationConfigurationElement)element).Path;
        }




        public List<string> ToStringList()
        {
            List<string> elements = new List<string>();
            foreach (SearchLoacationConfigurationElement element in this)
            {
                elements.Add(element.Path);
            }
            return elements;
        }

        #region IList Members

        public int Add(object value)
        {
            BaseAdd((SearchJobConfigurationElement)value);
            return this.Count - 1;
        }

        public void Clear()
        {
            BaseClear();
        }

        public bool Contains(object value)
        {
            throw new NotImplementedException();
        }

        public int IndexOf(object value)
        {
            return BaseIndexOf((ConfigurationElement)value);
        }

        public void Insert(int index, object value)
        {
            throw new NotImplementedException();
        }

        public bool IsFixedSize
        {
            get { return false; }
        }

        public new bool IsReadOnly
        {
            get { return false; }
        }

        public void Remove(object value)
        {
            throw new NotImplementedException();
        }

        public void RemoveAt(int index)
        {
            BaseRemoveAt(index);
        }

        public object this[int index]
        {
            get
            {
                return (SearchLoacationConfigurationElement)BaseGet(index);
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        #endregion
    }
}
